//
//  BDRequest.h
//  HSY
//
//  Created by 陈浩 on 2017/4/11.
//  Copyright © 2017年 金开门. All rights reserved.
//

#import "HSYBaseModel.h"
#import "BDResponse.h"
#import "BDFileModel.h"

typedef void (^BDSuccessHandler)(BDResponse *response);
typedef void (^BDErrorHandler)(NSError *error);
typedef void (^BDCompletionHandler)(id responseObject, NSString *resultString);


@interface BDRequest : HSYBaseModel

@property (nonatomic, copy) BDSuccessHandler success;
@property (nonatomic, copy) BDErrorHandler failure;
@property (nonatomic, weak) NSURLSessionTask *task;
@property (nonatomic, copy, readonly) NSArray<BDFileModel *> *files;

- (NSDictionary *)buildUrlParams;
- (NSDictionary *)requestData;
- (NSString *)serviceCode;
- (NSArray<BDFileModel *> *)files;
- (BOOL)needAccessToken; //需要附带token

- (BOOL)isRunning;
- (void)cancelCurrentTask; //取消请求

- (void)addFile:(NSData *)file withFileName:(NSString *)fileName toArray:(NSMutableArray *)array;

- (BOOL)fileUplaod;


@end
